package com.qidian.by.free.controller;

import com.qidian.by.free.service.FreeTemplateService;
import com.qidian.by.util.pojo.EsResult;
import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author: CoolPro
 * @Description:
 * @Time: 2024-05-16 19:16
 **/
@RestController
public class FreeTemplateController {
    @Resource
    private FreeTemplateService freeTemplateService;
    @PostMapping("/make")
    public EsResult<Map<String,String>> make(@RequestBody String itemData) throws IOException, TemplateException {
        return freeTemplateService.makeTemplate(itemData);
    }
}
